﻿Imports System.Data
Imports System.Data.SqlClient

Public Class TESTE
    Dim Str As String = My.Settings.online.ToString
    Dim sqlDa As New SqlDataAdapter
    Dim dtb As DataTable
    Dim sqlCon As New SqlConnection(Str)
    Dim sqlCmd As New SqlCommand


    Private Sub TESTE_Load(sender As Object, e As System.EventArgs) Handles Me.Load
        Try
            With sqlCmd
                .CommandType = CommandType.Text
                .CommandText = "SELECT * from ATRASOS"
                .Connection = sqlCon
            End With

            With sqlDa
                .SelectCommand = sqlCmd
                dtb = New DataTable
                .Fill(dtb)
                DataGridView1.DataSource = dtb
            End With
        Catch ex As Exception
            MsgBox(ex.Message)
        Finally
            sqlCon.Close()
        End Try

    End Sub
End Class